<!-- childComponent.vue -->
<template>
    <div>
        子组件内容：<input v-model="userName">
        <button @click="notifyParent">点击后，传递到父组件</button>
    </div>
  </template>
  
  <script>
  export default {
    data() {
      return {
        userName: ''
      }
    },
    methods: {
        notifyParent() {
        this.$emit('userNotified', this.userName);
      },
    }
  };
  </script>